﻿SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


ALTER PROCEDURE [dbo].[bhp_NemoGroupGetAll]
AS
BEGIN

	SELECT 
		t.id as Id,
		g.name as Name,
		t.name as SystemName,
		g.Identyficator,
		t.name as SelectTable,
		CASE t.typ WHEN 'T' THEN 'Table' WHEN 'V' THEN 'View' WHEN 'TE' THEN 'ExtendedTable' ELSE '' END as [Type]
	FROM 
		n_Tree t
		LEFT JOIN bht_Groups g ON t.id = g.Id
	WHERE
		(del IS NULL OR del = 0)
		AND typ IN ('V', 'T')
		AND parent = 0

END



GO

ALTER PROCEDURE [dbo].[bhp_NemoGroupGet]
	@Id				INT
AS
BEGIN

	SELECT 
		t.id as Id,
		g.name as Name,
		t.name as SystemName,
		g.Identyficator,
		t.name as SelectTable,
		CASE t.typ WHEN 'T' THEN 'Table' WHEN 'V' THEN 'View' WHEN 'TE' THEN 'ExtendedTable' ELSE '' END as [Type]
	FROM 
		n_Tree t
		LEFT JOIN bht_Groups g ON t.id = g.Id
	WHERE
		del = 0
		AND typ IN ('V', 'T')
		AND parent = 0
		AND t.id = @Id

END


GO
INSERT bht_NemoTranslates VALUES (0, 0, '', 'pl-PL', GETDATE(), 3000000)
GO
INSERT bht_NemoTranslates VALUES (0, 0, '', 'en-GB', GETDATE(), 3000000)